//
//  MianRecommendTableViewCell.m
//  Funny
//
//  Created by dllo on 15/10/31.
//  Copyright © 2015年 King. All rights reserved.
//

#import "MianRecommendTableViewCell.h"

@implementation MianRecommendTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.pic = [[UIImageView alloc]init];
        [self.contentView addSubview:self.pic];
        
        self.back = [[UIImageView alloc]init];
        self.back.image = [UIImage imageNamed:@"image.png"];
        [self.contentView addSubview:self.back];
        
        self.name = [[UILabel alloc]init];
        self.name.textColor = [UIColor whiteColor];
        self.name.font = [UIFont systemFontOfSize:19];
        [self.contentView addSubview:self.name];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.pic.frame = CGRectMake(0, 0, SelfWidth, SelfHeight - 1);
    self.back.frame = CGRectMake(0, SelfHeight - 40, SelfWidth, 39);
    WeakSelf(weakSelf);
    [self.name mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(weakSelf.contentView.mas_bottom).with.offset(-3);
        make.left.equalTo(@20);
        make.size.mas_equalTo(CGSizeMake(SelfWidth - 40, 30));
    }];
}

- (void)setModel:(MainRecommendModel *)model
{
    self.name.text = model.name;
    [self.pic sd_setImageWithURL:[NSURL URLWithString:model.place_pic] placeholderImage:[UIImage imageNamed:@"chartlet_image_traning@2x.png"]];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
